<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<html>
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
    <link rel="stylesheet" th:href="@{/css/index.css}" />
    <link rel="stylesheet" th:href="@{/css/common.css}" />
    <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}" />
    <title>账户-基本信息</title>
</head>
<body style="background: #F5F5F5;">
    <div th:include="~{/client/common/header :: header}"></div>
    <!-- Content -->
    <div class="accountMain">
        <div class="center clear">
            <!-- 左侧内容 -->
            <div class="left-box">
                <ul class="nav-list">
                    <li class="liActive"><a th:href="@{/userBaseMsg/userBaseMsg}">基本信息</a></li>
                    <li><a th:href="@{/userAsset/userAsset}">资产管理</a></li>
                    <li><a th:href="@{/nodeVote/nodeVote}">我的投票</a></li>
                </ul>
            </div>
            <!-- 右侧内容 -->
            <div class="rightWrap">
                <div class="page-one home">
                    <!-- 倒计时 -->
                    <div th:if="${userVerify.observer == true}">
                        <div class="top-box">
                            距离成为正式节点还剩<span class="joind">55</span>天<span class="joinh">10</span>小时<span  class="joinm">23</span>分<span class="joins">23</span>秒
                        </div>
                    </div>
                    <!-- 主体内容 -->
                    <div class="bottom" th:object="${userVerify}">
                        <table border="" cellspacing="" cellpadding="">
                            <tr>
                                <td>名称：</td>
                                <td th:text="*{companyName}">北京北大荒大米食品有限公司</td>
                            </tr>
                            <tr>
                                <td>身份：</td>
                                <td th:text="*{userType == 'ordinary_user' ? (observer == true ? '观察员' : '普通用户') : userTypeName}">观察员</td>
                            </tr>
                            <tr>
                                <td>手机号：</td>
                                <td th:text="*{phoneNo}">13000000000</td>
                            </tr>
                            <tr>
                                <td>地区：</td>
                                <td th:text="*{companyAddress}">北京市朝阳区</td>
                            </tr>
                            <tr>
                                <td>审核状态：</td>
                                <div th:if="*{verifyState == 'UN_VERIFY' or verifyState == 'VERIFY_FAIL'}">
                                    <td class="a-red"><span th:text="*{verifyStateName}"></span>，点击此处<a href="javascript:void(0);" id="form-submit">重新申请</a></td>
                                </div>
                                <div th:if="*{verifyState == 'VERIFIED' or verifyState == 'VERIFYING'}">
                                    <td th:text="*{verifyStateName}"></td>
                                </div>
                            </tr>
                        </table>
                        <input type="hidden" id="duration" name="duration" th:value="${duration}" placeholder=""/>
                        <form id="form-id" th:action="@{/register/toRegisterVerify}" method="post">
                            <input type="hidden" id="userId" th:name="userId" th:value="*{userId}" />
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<script th:src="@{/js/jquery-3.1.1.min.js}"></script>
<script th:src="@{/js/public.js}"></script>
<script type="text/javascript">
    var setTimer = null;
    var chazhi = $("#duration").val() * 1000;

    //执行函数部分
    countFunc(chazhi);

    setTimer = setInterval(function() {
        chazhi = chazhi - 1000;
        countFunc(chazhi);
    }, 1000);

    function countFunc(leftTime) {
        if(leftTime >= 0) {
            var days = parseInt(leftTime / 1000 / 60 / 60 / 24, 10); //计算剩余的天数
            var hours = parseInt(leftTime / 1000 / 60 / 60 % 24, 10); //计算剩余的小时
            var minutes = parseInt(leftTime / 1000 / 60 % 60, 10); //计算剩余的分钟
            var seconds = parseInt(leftTime / 1000 % 60, 10); //计算剩余的秒数
            days = checkTime(days);
            hours = checkTime(hours);
            minutes = checkTime(minutes);
            seconds = checkTime(seconds);
            $(".joind").html(days);
            $(".joinh").html(hours);
            $(".joinm").html(minutes);
            $(".joins").html(seconds);
        } else {
            clearInterval(setTimer);
            $(".joind").html("00");
            $(".joinh").html("00");
            $(".joinm").html("00");
            $(".joins").html("00");
        }
    }

    function checkTime(i) { //将0-9的数字前面加上0，例1变为01
        if(i < 10) { i = "0" + i; }
        return i;
    }

    $("#form-submit").on("click", function () {
        $("#form-id").submit();
    });
</script>
</html>
